package club.pchome.controller;

import club.pchome.common.util.PageUtil;
import club.pchome.model.CUser;
import club.pchome.service.CUserService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Watler
 */
@RestController
public class CUserController extends BaseController {


    @Autowired
    CUserService cUserService;



    @ApiOperation(value = "用户列表")
    @ApiImplicitParams({ @ApiImplicitParam(name = "holder", value = "归属人"), @ApiImplicitParam(name = "currPage", value = "当前页"), @ApiImplicitParam(name = "pageSize", value = "每页条数,0为全部")})
    @PostMapping("/userList")
    public PageUtil<CUser> userList(HttpServletRequest request, CUser cUser, String page, String limit){
        Map<String, Object> map = new HashMap<String, Object>();

        map.put("cUser", cUser);

        PageUtil<CUser> pu = new PageUtil<CUser>(page, limit);
        return cUserService.userList(pu , map);
    }


}
